﻿Imports DataAccess
Imports DTO
Public Class BSTerminalUserData
    Dim strServer As String

    Public Sub New(ByVal strServer As String)
        'Lay gia tri serverName ben Form
        strServer = strServer
        DATerminalUserData.ConfigServerName(strServer)
    End Sub

    '/******************************************************************/
    '/*             Lay datatable tu DataAccess                        */
    '/******************************************************************/
    Public Function GetAllTerminalUserData() As DataTable
        Return DATerminalUserData.GetAllTerminalUserData()
    End Function

    '/******************************************************************/
    '/*             Insert Terminal User Data                             */
    '/******************************************************************/
    Public Function InsertTerminalUserData(ByVal id As Integer, ByVal backup As Integer, ByVal machinePrivilege As Integer,
                                          ByVal enrollData As String, ByVal status As Integer, ByVal createDateTime As DateTime, ByVal updateDateTime As DateTime) As Integer
        Dim dtoTerminalUserData As New DTOTerminalUserData
        dtoTerminalUserData.IdProperty = id
        dtoTerminalUserData.BackupProperty = backup
        dtoTerminalUserData.MachinePrivilegeProperty = machinePrivilege
        dtoTerminalUserData.EnrollDataProperty = enrollData
        dtoTerminalUserData.StatusProperty = status
        dtoTerminalUserData.CreateDateTimeProperty = createDateTime
        dtoTerminalUserData.UpdateDateTimeProperty = updateDateTime
        Return DATerminalUserData.InsertTerminalUserData(dtoTerminalUserData)
    End Function

    '/******************************************************************/
    '/*             Update Terminal User Data                             */
    '/******************************************************************/
    Public Function UpdateTerminalUserData(ByVal id As Integer, ByVal backup As Integer, ByVal machinePrivilege As Integer,
                                          ByVal enrollData As String, ByVal status As Integer, ByVal updateDateTime As DateTime) As Integer
        Dim dtoTerminalUserData As New DTOTerminalUserData
        dtoTerminalUserData.IdProperty = id
        dtoTerminalUserData.BackupProperty = backup
        dtoTerminalUserData.MachinePrivilegeProperty = machinePrivilege
        dtoTerminalUserData.EnrollDataProperty = enrollData
        dtoTerminalUserData.StatusProperty = status

        dtoTerminalUserData.UpdateDateTimeProperty = updateDateTime
        Return DATerminalUserData.UpdateTerminalSetting(dtoTerminalUserData)
    End Function


End Class
